﻿@using System.Linq
@using Orchard.Core.Contents;
@using Orchard.Localization.Models;
@if (AuthorizedFor(Permissions.PublishContent))
{
    Script.Require("BackendAdditions");
    Style.Require("jQueryUI_Orchard");
    Style.Require("BackendAdditions");
@*IEnumerable<LocalizationPart> localizations  = Model.Localizations;
var localizationLinks = Html.UnorderedList(localizations, (c, i) => Html.ItemEditLink(c.Culture.Culture, c), "localizations");
    <div class="content-localization">
        @if (localizations.Count() > 0) {
            <div class="content-localizations"><h4>@T("Translations:")</h4>@localizationLinks</div>
        }
        <div class="add-localization">@Html.ActionLink(T("+ New translation").Text, "Translate", "Admin", new { area = "Orchard.Localization", id = Model.MasterId }, null)</div>
    </div>*@
    var items = Model.LocalizedChildren as List<So.BackendAdditions.Models.LocalizedItemSummaryAdminViewModel>;
    
    <span>
        @if (items != null && items.Any())
        {
            @T("Culture: {0}. Other translations:", Model.ItemCulture)
        }
        else
        {
            @T("Culture: {0}", Model.ItemCulture)
        }
    </span>
    
        if (items != null && items.Any())
        {
    <ul class="accordion">
        @foreach (var item in items)
        {
            <li>
                <div class="summary">
                    <h3 class="head">
                        <a href="#">@T(item.Name)</a></h3>
                    <div>
                        @Display(item.Shape)
                    </div>
                </div>
            </li>
        }
    </ul>
        }
    <div class="add-localization">@Html.ActionLink(T("+ New translation").Text, "Translate", "Admin", new { area = "Orchard.Localization", id = Model.MasterId }, null)</div>
}
